import logging, time, re
import logging.handlers


handler = logging.handlers.RotatingFileHandler('logs/waters.log', maxBytes = 50*1024*1024, backupCount = 10)
formatter = logging.Formatter('%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s - %(message)s')
handler.setFormatter(formatter)
console = logging.StreamHandler()
console.setLevel(logging.DEBUG)
console.setFormatter(formatter)
logging.getLogger('').addHandler(console)
rctLogger = logging.getLogger('waters')
rctLogger.addHandler(handler)
rctLogger.setLevel(logging.DEBUG)

def hthex2str(aVal) :
	tmpStr = ''
	if aVal and len(aVal) > 0 :
		for c in aVal :
			tmpStr += "%02X " % ord(c)
	return tmpStr

if __name__ == '__main__':
	rctLogger.debug('test')
